<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-form ref="form" :model="s_pro" :rules="rules" label-width="100px" id="mvcfm">
      <div class="form-unit">
        <span class="mvc-title-left"> 产品列表 </span>
      </div>
      <el-table :data="s_pro">
        <el-table-column label="#" align="center" type='index'>
        </el-table-column>
        <el-table-column label="任务标题" prop="pro_title">
        </el-table-column>
        <el-table-column label="产品名称" prop="product_name">
        </el-table-column>
        <el-table-column label="产品型号" prop="product_norm">
        </el-table-column>
        <el-table-column label="产品规格" prop="product_model">
        </el-table-column>
        <el-table-column label="需求数量" prop="pro_num">
        </el-table-column>
        <el-table-column label="入库时间" prop="storage_time">
          <template slot-scope="scope">
            {{getDateTimeString(scope.row,'storage_time')}}
          </template>
        </el-table-column>
      </el-table>
      <div class="form-unit">
        <span class="mvc-title-left"> 安排采购任务 </span>
      </div>
      <div>
        <el-row>
          <el-col :span="12">
            <el-form-item label="采购标题" prop="task_title">
              <el-input v-model="t_plan.task_title" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="产品名称" prop="">
              {{t_plan.product_name}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="供应商" prop="">
              {{t_plan.client_name}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="产品规格" prop="">
              {{t_plan.product_norm}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="产品型号" prop="">
              {{t_plan.product_model}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="经济批量" prop="">
              {{t_plan.economic_batch}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="采购数量" prop="pom_num">
              {{t_plan.product_num}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="开始时间" prop="">
              {{getDateTimeString(t_plan,'release_time')}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="入库时间" prop="storage_time">
              <el-date-picker v-model="t_plan.storage_time" type="date" style='width:100%' value-format="yyyy-MM-dd" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="采购员" prop="">
              {{t_plan.contact_name}}
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <el-button @click="arrangeProcureSubmit('')" type='success' size="mini"><i class='fa fa-check'></i>保存</el-button>
      <el-button @click="gotoPage('/psi/supplychainmana/IncreaseProcurementDet?'+vueparams+'')" type='primary' size="mini"><i class='fa fa-reply'></i>返回</el-button>
    </el-form>
  </div>
</template>
<script>
  import request from '@/utils/request'
  export default {
    name: 'ArrangeProcure',
    components: {},
    props: ['popparams'],
    data() {
      return {
        vueparams: this.getVUEParams(""),
        s_pro: [],
        t_plan: {
          task_title: null,
          product_name: null,
          client_name: null,
          product_norm: null,
          product_model: null,
          economic_batch: null,
          product_num: null,
          release_time: null,
          storage_time: null,
          contact_name: null,
        },
        loading: false,
        rules: {}
      }
    },
    created() {
      this.getData();
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/psi/supplychainmana/PurchaseStatisticalAction/arrangeProcure?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      arrangeProcureSubmit(_params) {
        this.$refs["form"].validate(valid => {
          if (valid) {
            request({
              method: 'post',
              url: '/xcapi/VUEAction/psi/supplychainmana/PurchaseStatisticalAction/arrangeProcureSubmit?' + _params + this.vueparams,
              data: this.postData()
            }).then(data => {
              this.gotoPage("/psi/supplychainmana/PurchaseStatistical/purchaseStatistical?" + this.vueparams, data);
              this.msgSuccess(data.msg);
            })
          } else {
            this.msgError("必填项错误");
          }
        });
      },
    },
  }
</script>
